There is also another way that works better especially if you need to add lots of lines of text, you can use the
cat commad and run it through a script.
Code:
#!/bin/sh
cat > test << EOF
Hello World!
This is my stupid text file.
You
can also
have
a whole lot
more text and
lines
EOF
You can also point it to a directory that you want the file created in.
Code:
#!/bin/sh
cat > /home/billy/test << EOF
Hello World!
This is my stupid text file.
You
can also
have
a whole lot
more text and
lines
EOF